var windowName = "fuelLog";
var Page
var Log = new List()
apiready = function(){
    onWindowShow(function () {
    })
    onWindowHide(function () {
    })
    console.log("index page is OK");
    Page = createVM("#Page",{
        //页面数据
        tab:1,
        list:[],
    },{
        //页面方法
        "init":function () {
            this.now = getDate()
            log(this.now)
            var _this = this;
            startPullDownRefresh();
            Log.setUrl("/app/fuel/log")
                .setCbFunc(function (data) {
                    logJson(data)
                    _this.list = data
                    stopPullDownRefresh();
                    stopPullUpLoadMore();
                }).getList()
        },
        OnPullDownRefresh:function () {
            startPullDownRefresh();
            Log.reload()
        },
        OnPullUpLoadMore:function () {
            if (this.tab === 0) {
                startPullUpLoadMore();
                Log.getList()
            }
        },
        submit:function (index) {
            var en = this.list[index]
            logJson(en)
            apiPost("/app/fuel/log/save",{id:en.CarFuelLog_id,tips:en.CarFuelLog_check_Text},function (res) {
                logJson(res)
                Log.reload()
            })

        },
        del:function (index) {
            var en = this.list[index]
            logJson(en)

            apiPost("/app/fuel/log/del",{id:en.CarFuelLog_id,tips:en.CarFuelLog_check_Text},function (res) {
                logJson(res)
                Log.reload()
            })
        }
    })

    Page.init()

}